package cn.tedu.csmall.product.schedule;

import cn.tedu.csmall.product.service.IBrandService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@EnableScheduling
public class CacheSchedule {

    @Autowired
    private IBrandService brandService;

    //fixedRate ：执行计划任务的间隔时间，已毫秒为单位
    @Scheduled(fixedRate = 3 * 60 * 1000)
    public void xxx() {
        log.debug("开始执行计划任务。。。");
        brandService.rebuildCache();
    }
}
